package cn.bs.ktv.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import cn.bs.ktv.model.input.PageInput;

public class PagedModel<T> extends PageInput implements Serializable {
    private static final long serialVersionUID = -2858545117575078904L;

    private Integer totalCount;

    private List<T> list;

    public PagedModel() {
        totalCount = 0;
        list = new ArrayList<>();
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Integer getTotalPage() {
        return (totalCount + getPageSize() - 1) / getPageSize();
    }

    public boolean hasData() {
        return totalCount > 0 && list.size() > 0;
    }
}
